Class TestLogger

Summary

Fully Qualified Name: CodeIgniter\Test\TestLogger
Extends: Logger

Description

Methods

Name Description Defined By
__construct() Constructor. Logger
alert() Action must be taken immediately. Logger
cleanup() TestLogger
critical() Critical conditions. Logger
debug() Detailed debug information. Logger
determineFile() Determines the file and line that the logging call was made from by analyzing the backtrace. Logger
didLog() Used by CIUnitTestCase class to provide ->assertLogged() methods. TestLogger
emergency() System is unusable. Logger
error() Runtime errors that do not require immediate action but should typically be logged and monitored. Logger
info() Interesting events. Logger
log() The log method is overridden so that we can store log history during the tests to allow us to check ->assertLogged() methods. TestLogger
notice() Normal but significant events. Logger
warning() Exceptional occurrences that are not errors. Logger

Method Details

__construct()

Constructor.

Parameter Name Type Description
$config \Config\Logger
$debug bool

Returns:

alert()

Action must be taken immediately.

Example: Entire website down, database unavailable, etc. This should trigger the SMS alerts and wake you up.

Parameter Name Type Description
$message string
$context array

Returns: bool

cleanup()

Parameter Name Type Description
$file

Returns: void

critical()

Critical conditions.

Example: Application component unavailable, unexpected exception.

Parameter Name Type Description
$message string
$context array

Returns: bool

debug()

Detailed debug information.

Parameter Name Type Description
$message string
$context array

Returns: bool

determineFile()

Determines the file and line that the logging call was made from by analyzing the backtrace.

Find the earliest stack frame that is part of our logging system.

Returns: array

didLog()

Used by CIUnitTestCase class to provide ->assertLogged() methods.

Parameter Name Type Description
$level string
$message string

Returns: bool

emergency()

System is unusable.

Parameter Name Type Description
$message string
$context array

Returns: bool

error()

Runtime errors that do not require immediate action but should typically be logged and monitored.

Parameter Name Type Description
$message string
$context array

Returns: bool

info()

Interesting events.

Example: User logs in, SQL logs.

Parameter Name Type Description
$message string
$context array

Returns: bool

log()

The log method is overridden so that we can store log history during the tests to allow us to check ->assertLogged() methods.

Parameter Name Type Description
$level string
$message string
$context array

Returns: bool

notice()

Normal but significant events.

Parameter Name Type Description
$message string
$context array

Returns: bool

warning()

Exceptional occurrences that are not errors.

Example: Use of deprecated APIs, poor use of an API, undesirable things that are not necessarily wrong.

Parameter Name Type Description
$message string
$context array

Returns: bool

Top